package com.example.mybatis.flex.dao;

import com.example.mybatis.flex.entity.User;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <pre>
 * 第 1 种自定义 findByJpql
 * 第 2 种自定义 findCustomerBySpec
 * 第 3 种自定义 @see UserExtOperation # findExtends
 * </pre>
 *
 * @author fanhang
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 第 1 种自定义
     */
    @Select("select * from t_user where age > #{id} and remark like concat('%', #{name}, '%')")
    @ResultType(User.class)
    List<User> findByAgeLikeName(@Param("age") int age, @Param("name") String name);

}
